package de.jonasblatt.networkapi.rpi.network.commands.client;

import de.jonasblatt.networkapi.rpi.model.RpiWorker;
import de.jonasblatt.networkapi.rpi.network.commands.ClientCommand;
import de.jonasblatt.networkapi.rpi.network.commands.server.SCSayHelloBack;
import de.jonasblatt.networkapi.rpi.network.server.Server;

public class CCSayHello implements ClientCommand {

	private int clientId;
	private String name;

	public CCSayHello(int clientId, String name) {
		this.clientId = clientId;
		this.name = name;
	}

	@Override
	public void execute(Server server) {
		RpiWorker rpiWorker = (RpiWorker) server.getModel();
		server.updateClient(this.clientId,
				new SCSayHelloBack(rpiWorker.sayHello(this.name)));
	}
}
